<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>内容管理</title>
	<jsp:include page="../../import.jsp" flush="true" />
	<script src="<%=path %>/resource/lib/ueditor/ueditor.config.js" charset="utf-8" type="text/javascript"></script>
	<script src="<%=path %>/resource/lib/ueditor/ueditor.all.min.js" charset="utf-8" type="text/javascript"></script>
	<!--建议手动加载语言，避免在IE下有时因为加载语言失败导致编辑器加载失败-->
	<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
	<script src="<%=path %>/resource/lib/ueditor/lang/zh-cn/zh-cn.js" charset="utf-8" type="text/javascript"></script>
	<script type="text/javascript">
		$(function () {
			initForm();
			initUedit();
			saveEvent();
		});

		//初始化表单
		function initForm(){
			$("#formSet1").ligerForm({
				validate: true
			});
		}
		function initUedit(){
			var ue = UE.getEditor('editor');
			ue.addListener("ready", function () {
				// editor准备好之后才可以使用
				ue.setContent($("#uecontent").html());
			});
		}
		//保存事件
		function saveEvent(){
			$("#saveBtn1").click(function(event) {
				var form = liger.get("formSet1");
				if (!form.valid()) {
					top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
					return false; //验证不通过，不执行以下代码
				}
				var cntDtl=UE.getEditor('editor').getContent();
				var data = form.getData();
				data["cntDtl"] = cntDtl;
				var url = '<%=path%>/custpay/cmsCmmCntDc/modifyCmsCmmCntDc.do';
				var wait_dialog;
				$.ajax({
					type: 'post',
					dataType:'json',
					data:data,
					url: url,
					beforeSend: function(){
						wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
					},
					success:function(msg){
						wait_dialog.close();
						if(msg.success == 1){
							top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
							var callback=GET_W2Wcallback();
							callback();
							Remove_navTab ();
						}else{
							top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
						}
					}
				});
			});
		}
	</script>
</head>
<body class="iframeBody">
<div class="Wrapper">
	<form id="formSet1">
		<table class="layout2col1">
			<tbody>
			<tr>
				<td valign="top">
					<div class="fieldset1 tabel_col clearFix">
						<div class="fieldBox col_100_auto">
							<div class="label">内容所属板块</div>
							<div class="field">
								<select name="cntCd" id="cntCd" validate="{required:true,select:true}">
									<option value=" " >请选择</option>
									<c:forEach items="${cntcdlist }" var="cntcdop">
										<option value="${cntcdop.key }" <c:if test="${cmscmmcntdc.cntCd == cntcdop.key}">selected</c:if>>${cntcdop.value }</option>
									</c:forEach>
								</select>
							</div>
						</div>
						<div class="fieldBox col_100_auto">
							<div class="label">内容名称</div>
							<div class="field">
								<input name="cntNm" id="cntNm" type="text" class="ui-textbox" value="${cmscmmcntdc.cntNm}" validate="{required:true}">
							</div>
						</div>

						<div class="fieldBox col_100_auto">
							<div class="label">内容</div>
							<div class="field" style="width: 100%; box-sizing: border-box;">
								<script id="editor" type="text/plain" style="width:99%; height:280px;"></script>
							</div>
						</div>
						<div class="fieldBox col_100_auto">
							<div class="label">是否上线</div>
							<div class="field">
								<c:choose>
									<c:when test="${not empty cmscmmcntdc && cmscmmcntdc.isOl==1}">
										是<input type="radio" name="isOl" value="1" checked>&nbsp;&nbsp;
										否<input type="radio" name="isOl" value="0">
									</c:when>
									<c:otherwise>
										是<input type="radio" name="isOl" value="1" >&nbsp;&nbsp;
										否<input type="radio" name="isOl" value="0" checked>
									</c:otherwise>
								</c:choose>
							</div>
						</div>
					</div>

					<div id="btnsBox" class="btnsBox">
						<input name="cntId" id="cntId" type="text" style="display: none;" value="${cmscmmcntdc.cntId}"/>
						<span id="saveBtn1" class="sq-button sq-button-round">保存</span>
						<input type="reset" id="resetBtn" class="l-button l-button-reset Hide">
					</div>
				</td>
			</tr>
			</tbody>
		</table>
	</form>
</div>
<div class="clearLine"></div>
<div id="uecontent" style="display:none">${cmscmmcntdc.cntDtl}</div>
</body>
</html>